package com.treetao.union.db.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.treetao.union.db.mapper.SysRescourceDao;
import com.treetao.union.db.model.SysRescource;
import com.treetao.union.db.service.SysRescourceService;

/**
 * <p>
 * 系统资源 服务实现类
 * </p>
 */
@Service
@Transactional(readOnly = true, rollbackFor = Exception.class)
public class SysRescourceServiceImpl extends ServiceImpl<SysRescourceDao, SysRescource> implements SysRescourceService {

    @Override
    public int getCountByHash(String hash) {
    	QueryWrapper<SysRescource> wrapper = new QueryWrapper<>();
        wrapper.eq("hash",hash);
        return count(wrapper);
    }

    @Override
    public SysRescource getRescourceByHash(String hash) {
        QueryWrapper<SysRescource> wrapper = new QueryWrapper<>();
        wrapper.eq("hash",hash);
        return getOne(wrapper);
    }
}
